import {
	axios
} from './http.js';




export const get_address = ({
	type = "GET",
} = {}) => {
	return axios({
		path: "/api/user/ad/get_user_address",
		type: type
	});
};

export const get_address_one = ({
	type = "GET",
	a_id=''
} = {}) => {
	return axios({
		path: "/api/user/ad/get_user_address_one",
		type: type,
		data:{
			'a_id':a_id
		}
	});
};
export const delete_address = ({
	type = "POST",
	a_id=''
} = {}) => {
	return axios({
		path: "/api/user/ad/delete_address",
		type: type,
		data:{
			'a_id':a_id
		}
	});
};

export const set_address_default = ({
	type = "POST",
	a_id=''
} = {}) => {
	return axios({
		path: "/api/user/ad/set_address_default",
		type: type,
		data:{
			'a_id':a_id
		}
	});
};

export const add_address = ({
	type = "POST",
	province_name='',
	province_id='',
	city_name='',
	city_id='',
	area_name='',
	area_id='',
	detail_name='',
	default_address='',
	name='',
	phone='',
} = {}) => {
	return axios({
		path: "/api/user/ad/user_add_address",
		type: type,
		data:{
			'province_name':province_name,
			'province_id':province_id,
			'city_name':city_name,
			'city_id':city_id,
			'area_name':area_name,
			'area_id':area_id,
			'detail_name':detail_name,
			'default_address':default_address,
			'name':name,
			'phone':phone
		}
	});
};

export const update_address = ({
	type = "POST",
	province_name='',
	province_id='',
	city_name='',
	city_id='',
	area_name='',
	area_id='',
	detail_name='',
	default_address='',
	name='',
	phone='',
	a_id = ''
} = {}) => {
	return axios({
		path: "/api/user/ad/update_address",
		type: type,
		data:{
			'province_name':province_name,
			'province_id':province_id,
			'city_name':city_name,
			'city_id':city_id,
			'area_name':area_name,
			'area_id':area_id,
			'detail_name':detail_name,
			'default_address':default_address,
			'name':name,
			'phone':phone,
			'a_id':a_id
		}
	});
};



export default {
	add_address,
	get_address,
	delete_address,
	update_address,
	get_address_one,
	set_address_default
}
